﻿<catel:UserControl x:Class="Catel.Examples.WPF.MasterDetail.Views.PersonDetailView"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				   xmlns:catel="http://catel.codeplex.com"
                   xmlns:Models="clr-namespace:Catel.Examples.Models;assembly=Catel.Examples.WPF.Models"
                   xmlns:Converters="clr-namespace:Catel.Examples.WPF.MasterDetail.Converters">

    <UserControl.Resources>
        <Converters:GenderToIsSelectedConverter x:Key="GenderToIsSelectedConverter" />
    </UserControl.Resources>

    <catel:StackGrid>
        <!-- Row definitions -->
        <catel:StackGrid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </catel:StackGrid.RowDefinitions>

        <!-- Column definitions -->
        <catel:StackGrid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" MinWidth="300" />
        </catel:StackGrid.ColumnDefinitions>

        <!-- Gender -->
        <Label Content="Gender" />
        <StackPanel Orientation="Horizontal" x:Name="genderStackPanel">
            <RadioButton Content="Male" IsChecked="{Binding Gender, Converter={StaticResource GenderToIsSelectedConverter}, ConverterParameter={x:Static Models:Gender.Male}, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" 
                         Validation.ValidationAdornerSiteFor="{Binding ElementName=genderStackPanel}" />
            <RadioButton Content="Female" IsChecked="{Binding Gender, Converter={StaticResource GenderToIsSelectedConverter}, ConverterParameter={x:Static Models:Gender.Female}, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" 
                         Validation.ValidationAdornerSiteFor="{Binding ElementName=genderStackPanel}" />
        </StackPanel>

        <!-- First name -->
        <Label Content="First name" />
        <TextBox Text="{Binding FirstName, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />

        <!-- Middle name -->
        <Label Content="Middle name" />
        <TextBox Text="{Binding MiddleName, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />

        <!-- Last name -->
        <Label Content="Last name" />
        <TextBox Text="{Binding LastName, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />
    </catel:StackGrid>
</catel:UserControl>
